<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class system_settings extends CI_Controller {
	
	public function __construct() {
		parent::__construct();
		ini_set('session.cookie_httponly',1); 
		ini_set('session.use_only_cookies',1);	
		$this->load->model('system_setting_class');
	}	 
	public function list_system_settings(){
		$data = array();
		
		$system_settings = $this->system_setting_class->list_system_settings();
		if($system_settings!=0){
			foreach($system_settings as $key=>$value){
				$data['intID'][$key]=$value['intID'];	
				$data['strValue'][$key]=$value['strValue'];	
			}
		}
		echo json_encode($data);
	}
	public function get_system_settings(){
		$post = $this->input->post();
		$systemSettings = $this->system_setting_class->get_system_settings($post);
		echo json_encode($systemSettings);
	}	 
	public function save_settings(){
		$post = $this->input->post();
		$message = '';
		$systemSettings = $this->system_setting_class->get_system_settings($post);
		//$test=$this->db->last_query();
		if($systemSettings!=0){
			$message = $this->system_setting_class->update($post);
		}
		//$message['qry'] = $test;
		echo json_encode($message);
	}
	public function delete_settings(){
		$post = $this->input->post();
		$systemSettings = $this->system_setting_class->delete($post);
		echo json_encode($systemSettings);
	}
}